﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Tester
{
    class Mock
    {
        public static ScoreList GetScore()
        {
            var data = new ScoreList()
            {
                Title = "初三七班2007学年期中考试成绩表",
                Author = "班主任",
                CreateDate = DateTime.Now,
                Sign = "D:\\Resources\\1.jpg",
                Students = new List<Student>(){
                    new Student() {Id = "20060307001",Age = 17,Name = "学生甲",Sex = "男",
                        Subjects = new List<ScoreDetail>(){
                            new ScoreDetail() {Subject = "数学",Score = 100},
                            new ScoreDetail() {Subject = "语文",Score = 90},
                            new ScoreDetail() {Subject = "英语",Score = 90},
                            new ScoreDetail() {Subject = "化学",Score = 100},
                            new ScoreDetail() {Subject = "物理",Score = 100},
                            new ScoreDetail() {Subject = "政治",Score = 90}
                        }},
                    new Student() {Id = "20060307002",Age = 17,Name = "学生乙",Sex = "女",
                        Subjects = new List<ScoreDetail>(){
                            new ScoreDetail() {Subject = "数学",Score = 90},
                            new ScoreDetail() {Subject = "语文",Score = 100},
                            new ScoreDetail() {Subject = "英语",Score = 100},
                            new ScoreDetail() {Subject = "化学",Score = 90},
                            new ScoreDetail() {Subject = "物理",Score = 90},
                            new ScoreDetail() {Subject = "政治",Score = 100}
                        }},
                }
            };

            data.Students.ForEach(x =>{
                x.TotalScore = x.Subjects.Sum(s => s.Score);
                x.AvgScore = x.Subjects.Average(s => (double)s.Score);
            });
            return data;
        }
        public static ScoreList GetScore2()
        {
            var rd = new Random(DateTime.Now.Millisecond);
            var data = new ScoreList()
            {
                Title = "高三七班2008学年期中考试成绩表",
                Author = "班主任",
                CreateDate = DateTime.Now,
                Sign = "D:\\Resources\\2.png",
                Students = new List<Student>()
                {
                    new Student() {Id = "20060307001",Age = 17,Name = "刘德华",Sex = "男",
                        Subjects = new List<ScoreDetail>()
                        {
                            new ScoreDetail() {Subject = "数学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "语文",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "英语",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "化学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "物理",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "政治",Score = rd.Next(60,101)}
                        }},
                    new Student() {Id = "20060307002",Age = 17,Name = "张学友",Sex = "男",
                        Subjects = new List<ScoreDetail>()
                        {
                            new ScoreDetail() {Subject = "数学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "语文",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "英语",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "化学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "物理",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "政治",Score = rd.Next(60,101)}
                        }},
                    new Student() {Id = "20060307003",Age = 17,Name = "郭富城",Sex = "男",
                        Subjects = new List<ScoreDetail>()
                        {
                            new ScoreDetail() {Subject = "数学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "语文",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "英语",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "化学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "物理",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "政治",Score = rd.Next(60,101)}
                        }},
                    new Student() {Id = "20060307004",Age = 17,Name = "黎明",Sex = "男",
                        Subjects = new List<ScoreDetail>()
                        {
                            new ScoreDetail() {Subject = "数学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "语文",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "英语",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "化学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "物理",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "政治",Score = rd.Next(60,101)}
                        }},
                    new Student() {Id = "20060307005",Age = 17,Name = "张曼玉",Sex = "女",
                        Subjects = new List<ScoreDetail>()
                        {
                            new ScoreDetail() {Subject = "数学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "语文",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "英语",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "化学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "物理",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "政治",Score = rd.Next(60,101)}
                        }},
                    new Student() {Id = "20060307006",Age = 17,Name = "王祖贤",Sex = "女",
                        Subjects = new List<ScoreDetail>()
                        {
                            new ScoreDetail() {Subject = "数学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "语文",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "英语",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "化学",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "物理",Score = rd.Next(60,101)},
                            new ScoreDetail() {Subject = "政治",Score = rd.Next(60,101)}
                        }},
                }
            };

            data.Students.ForEach(x =>
            {
                x.TotalScore = x.Subjects.Sum(s => s.Score);
                x.AvgScore = x.Subjects.Average(s => (double)s.Score);
            });
            return data;
        }
    }
}